#ifndef SIM900_H
#define SIM900_H

#define SIM900_APN "net"
#define SIM900_USER "net"
#define SIM900_PASSWD ""
#define SIM900_PROTOCOL "TCP"
#define SIM900_SERVER "www.unicomp.hu"
#define SIM900_PORT "9001"
#define SIM900_RECONNECT 3
#define SIM900_RESEND 6

#define SIM900_AM_DEBUG
//#define SIM900_DRIVER_DEBUG
enum
{
	SIMSTATE_OFF,
	SIMSTATE_ON,
	SIMSTATE_OFFING,
	SIMSTATE_ONING,
	SIMSTATE_REGISTERING,
	SIMSTATE_IDLE,
	SIMSTATE_SOCKET_CONN_DELAY,
	SIMSTATE_SOCKET_CONN,
	SIMSTATE_SOCKET_IDLE,
	SIMSTATE_SOCKET_SEND_CONS_DELAY,
	SIMSTATE_SOCKET_SEND_CONS,
	SIMSTATE_SOCKET_SEND_DELAY,
	SIMSTATE_SOCKET_SEND,
	SIMSTATE_SOCKET_CLOSE_DELAY,
	SIMSTATE_SOCKET_CLOSE,
	SIMSTATE_SOCKET_DISPOSED
};
	
enum
{
	DELAY_POWER = 4000,
	DELAY_REGISTERING = 4000,
	DELAY_OPENSOCKET = 3000,
	DELAY_WR_SOCKET_CONS = 50,
	DELAY_WR_SOCKET = 50,
	DELAY_CLOSE_SOCKET = 100,
};

enum
{
	RECEIVE_BUFFER_SIZE = 255,
	COMMAND_BUFFER_SIZE = 255,
};

enum 
{
	SIM900_CONSOLE_TERM = 0x1A,
	SIM900_PACKET_AUXDATA = 17,
};

enum 
{
	AMSTATE_OFF,
	AMSTATE_STARTING,
	AMSTATE_ON,
	AMSTATE_SENDING,
	AMSTATE_STARTING_DELAY,
	AMSTATE_SENDING_DELAY,
};

typedef nx_struct sim900_header 
{
	nx_uint8_t fullLenght;
	nx_uint8_t protocol;
	nx_uint8_t dispatch;
	nx_am_addr_t dest;
	nx_am_addr_t src;
	nx_uint8_t length;
	nx_am_group_t group;
	nx_am_id_t type;
} sim900_header_t;

typedef nx_struct sim900_packet 
{
	sim900_header_t header;
	nx_uint8_t data[];
} sim900_packet_t;

#endif /* SIM900_H */
